package com.xiaoma.myaudience.biz.model;

import org.json.JSONException;
import org.json.JSONObject;

import android.os.Parcel;
import android.os.Parcelable;

public class HotVideoInfo extends BaseVideoInfo{    
    public static final String PARAM_SCORE = "score";
    public static final String PARAM_LAUNCH = "launch";
    public static final String PARAM_PERFORMER = "performer";
    public static final String PARAM_TYPE = "type";
    
    public float mScore;
    public String mLaunch;  
    public String mPerformer;
    public String mType;
    

    @Override
    public void readFromJSONObject(JSONObject o) throws JSONException {
        super.readFromJSONObject(o);
        if (o != null) {
            if (o.has(PARAM_SCORE))
                mScore = (float)o.getDouble(PARAM_SCORE);
            if (o.has(PARAM_LAUNCH))
                mLaunch = o.getString(PARAM_LAUNCH);
            if (o.has(PARAM_PERFORMER))
                mPerformer = o.getString(PARAM_PERFORMER);
            if (o.has(PARAM_TYPE))
                mType = o.getString(PARAM_TYPE);
        }
    }

    @Override
    public void readFromParcel(Parcel source) {
        super.readFromParcel(source);
        mScore = source.readFloat();
        mLaunch = source.readString();
        mPerformer = source.readString();
        mType = source.readString();
    }

    @Override
    public void writeToParcel(Parcel parcel, int paramInt) {
        super.writeToParcel(parcel, paramInt);
        parcel.writeFloat(mScore);
        parcel.writeString(mLaunch);
        parcel.writeString(mPerformer);
        parcel.writeString(mType);
        
    }

    public static final Parcelable.Creator<HotVideoInfo> CREATOR = new Creator<HotVideoInfo>() {
        public HotVideoInfo createFromParcel(Parcel source) {
            HotVideoInfo info = new HotVideoInfo();
            info.readFromParcel(source);
            return info;
        }

        public HotVideoInfo[] newArray(int size) {
            return new HotVideoInfo[size];
        }
    };  
}
